import Router from '@koa/router'
import { menuController } from '../controllers/menu'

const router = new Router({
  prefix: '/api/v1/menus'
})

// 菜单相关路由 - RESTful 风格
router.post('/', menuController.create) // 创建菜单
router.delete('/:id', menuController.delete) // 删除菜单
router.delete('/:id/with-children', menuController.deleteWithChildren) // 删除菜单及其子菜单
router.put('/:id', menuController.update) // 更新菜单
router.get('/', menuController.findAll) // 获取所有菜单
router.get('/:id', menuController.findOne) // 获取单个菜单
router.get('/parent/:parentId', menuController.findByParentId) // 根据父菜单ID查询子菜单

export default router
